Skip to content

added {model: string;} arg to client.connect() #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

djfm
Copy link

@djfm djfm commented May 4, 2025

As it was, the library did not allow setting the
model used by the realtime API.

This commit should fix that by making the model
a mandatory argument of the client.connect method.

The model must be passed to connect as a string property called model in an object.

E.g.

client.connect({ model: 'gpt-4o-mini-realtime-preview' });

I've made the argument mandatory because if you use the wrong model your wallet can suffer quickly.

The mini model is like 10x less expensive. Just sayin'...

As it was, the library did not allow setting the
model used by the realtime API.

This commit should fix that by making the model
a mandatory argument of the `client.connect` method.

The model must be passed to `connect` as a string property
called `model` in an object.
@djfm
Copy link
Author

djfm commented May 8, 2025 via email

@iemesowum
Copy link

iemesowum commented May 8, 2025

Oh sorry about that, hadn't noticed. Thanks for the review. I had the library already added to my project as a submodule so I performed the changes directly from the submodule as it was very convenient for testing. Then tsc must have somehow picked up the type specialization from the parent project I suppose? P.S.: I'm replying to the e-mail notification, I have no idea if and where this will appear on GitHub, couldn't find the comment on the website.

On Thu, May 8, 2025, 22:23 iemesowum @.> wrote: @.* commented on this pull request. ------------------------------ In dist/lib/conversation.d.ts <#112 (comment)> : > @@ -66,7 +66,7 @@ export class RealtimeConversation { 'response.audio.delta': (event: any) => { item: any; delta: { - audio: Int16Array; + audio: Int16Array; Minor comment: this doesn't appear to be related to the main change. — Reply to this email directly, view it on GitHub <#112 (review)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALESE7UDU3WE3CYMZKAO7D25O4KNAVCNFSM6AAAAAB4NC5NQSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDQMRWGI3TQMZWHE . You are receiving this because you authored the thread. Message ID: </pull/112/review/2826278369@ github.com>

I deleted my comment. 😄

It still applies, but it's okay.

I also got the workaround here working from the relay server:

#89 (comment)

...after applying the patch to use the passed in model.

EDIT: which you also fixed, of course: https://github.com/openai/openai-realtime-api-beta/pull/112/files#diff-3814d8caba69e5fdf3b23eed56ec7d708b8ede5aed6d686ac579421877938ec7R116.

@djfm
Copy link
Author

djfm commented May 8, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants